/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author harold
 */
@Entity
@Table(name = "type_nature")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TypeNature.findAll", query = "SELECT t FROM TypeNature t"),
    @NamedQuery(name = "TypeNature.findByIdTypeNature", query = "SELECT t FROM TypeNature t WHERE t.idTypeNature = :idTypeNature"),
    @NamedQuery(name = "TypeNature.findByDescription", query = "SELECT t FROM TypeNature t WHERE t.description = :description"),
    @NamedQuery(name = "TypeNature.findByStatus", query = "SELECT t FROM TypeNature t WHERE t.status = :status")})
public class TypeNature implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_type_nature")
    private Integer idTypeNature;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 256)
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Column(name = "status")
    private int status;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTypeNature")
    private Collection<Person> personCollection;

    public TypeNature() {
    }

    public TypeNature(Integer idTypeNature) {
        this.idTypeNature = idTypeNature;
    }

    public TypeNature(Integer idTypeNature, String description, int status) {
        this.idTypeNature = idTypeNature;
        this.description = description;
        this.status = status;
    }

    public Integer getIdTypeNature() {
        return idTypeNature;
    }

    public void setIdTypeNature(Integer idTypeNature) {
        this.idTypeNature = idTypeNature;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @XmlTransient
    public Collection<Person> getPersonCollection() {
        return personCollection;
    }

    public void setPersonCollection(Collection<Person> personCollection) {
        this.personCollection = personCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTypeNature != null ? idTypeNature.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TypeNature)) {
            return false;
        }
        TypeNature other = (TypeNature) object;
        if ((this.idTypeNature == null && other.idTypeNature != null) || (this.idTypeNature != null && !this.idTypeNature.equals(other.idTypeNature))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.TypeNature[ idTypeNature=" + idTypeNature + " ]";
    }
    
}
